﻿Public Class MainMenu
    Private systemsettings As New My.MySettings

    Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click
        Me.Hide()
        InvoiceForm.Show()
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        Me.Hide()
        ManageCustomer.Show()
    End Sub

    Private Sub PictureBox4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox4.Click
        Me.Hide()
        ManageEmployee.Show()
    End Sub

    Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
        Me.Hide()
        ManageInvoice.Show()
    End Sub

    Private Sub PictureBox5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox5.Click
        Me.Hide()
        Settings.Show()

    End Sub

    Private Sub MainMenu_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        'Reload the settings before keyboard keys are pressed. TC
        systemsettings.Reload()

        'gets each key code and opens its corresponding window. TC 
        If e.KeyCode = systemsettings.MainMenuInvoiceFormShortcut Then
            Me.Hide()
            InvoiceForm.Show()
        ElseIf e.KeyCode = systemsettings.MainMenuManageCustomerShortcut Then
            Me.Hide()
            ManageCustomer.Show()
        ElseIf e.KeyCode = systemsettings.MainMenuManageEmployeeShortcut Then
            Me.Hide()
            ManageEmployee.Show()
        ElseIf e.KeyCode = systemsettings.MainMenuManageInvoiceShortcut Then
            Me.Hide()
            ManageInvoice.Show()
        ElseIf e.KeyCode = systemsettings.MainMenuSettingsShortcut Then
            Me.Hide()
            Settings.Show()
        End If
    End Sub

    Private Sub MainMenu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



        'Load seetings into "shortcut labels" on top of each image. TC

        ' Converts the e.keycodes to Keyboard letters AJ
        Label7.Text = "Keyboard shortcut : " & Chr(systemsettings.MainMenuInvoiceFormShortcut)
        Label8.Text = "Keyboard shortcut : " & Chr(systemsettings.MainMenuManageCustomerShortcut)
        Label9.Text = "Keyboard shortcut : " & Chr(systemsettings.MainMenuManageEmployeeShortcut)
        Label10.Text = "Keyboard shortcut : " & Chr(systemsettings.MainMenuManageInvoiceShortcut)
        Label11.Text = "Keyboard shortcut : " & Chr(systemsettings.MainMenuSettingsShortcut)


       
    End Sub
End Class
